package com.qyhl.webtv.module_news.news.normal;

import com.qyhl.webtv.commonlib.entity.intergral.CoinBean;
import com.qyhl.webtv.commonlib.entity.news.AdvHomeBean;
import com.qyhl.webtv.commonlib.entity.news.NormalNewsBean;

import java.util.List;

/**
 * Created by qyhl on 2017/11/17.
 */

public class NormalNewsPresenter implements NormalNewsContract.NormalPresenter {
    private NormalNewsModel mModel;
    private NormalNewsActivity mView;

    public NormalNewsPresenter(NormalNewsActivity mView) {
        this.mView = mView;
        this.mModel = new NormalNewsModel(this);
    }

    @Override
    public void commentSuccess(List<NormalNewsBean.ArticleComment> list) {
        mView.commentSuccess(list);
    }

    @Override
    public void commentError(int code, String msg) {
        mView.commentError(code, msg);
    }

    @Override
    public void sendSuccess(String msg) {
        mView.sendSuccess(msg);
    }

    @Override
    public void sendError(String msg) {
        mView.sendError(msg);
    }

    @Override
    public void setDetail(NormalNewsBean bean) {
        mView.setDetail(bean);
    }

    @Override
    public void detailError(int errorId, String msg) {
        if (errorId == 0) {
            mView.detailError(msg);
        } else if (errorId == 1) {
            mView.showEmpty(msg);
        } else {

        }
    }

    @Override
    public void collectSuccess(String msg) {
        mView.collectSuccess(msg);
    }

    @Override
    public void cancelCollectSuccess() {
        mView.cancelCollectSuccess();
    }

    @Override
    public void collectError(String msg) {
        mView.collectError(msg);
    }

    @Override
    public void cancelCollectError(String msg) {
        mView.cancelCollectError(msg);
    }

    @Override
    public void likeSuccess() {
        mView.likeSuccess();
    }

    @Override
    public void likeError(String msg) {
        mView.likeError(msg);
    }

    @Override
    public void cancelLikeSuccess() {
        mView.cancelLikeSuccess();
    }

    @Override
    public void cancelLikeError(String msg) {
        mView.cancelLikeError(msg);
    }

    @Override
    public void setAdv(List<AdvHomeBean> beanList) {
        mView.setAdv(beanList);
    }

    @Override
    public void advError() {
        mView.advError();
    }

    @Override
    public void cancelCollect() {
        mView.cancelCollect();
    }

    @Override
    public void getDetail(String newsId) {
        mModel.getDetail(newsId);
    }

    @Override
    public void getComment(String newsId) {
        mModel.getComment(newsId);
    }

    @Override
    public void getAdv(String sectionId) {
        mModel.getAdv(sectionId);
    }

    @Override
    public void count(String newsId) {
        mModel.count(newsId);
    }

    @Override
    public void collect(String newsId) {
        mModel.collect(newsId);
    }

    @Override
    public void cancelCollect(String newsId) {
        mModel.cancelCollect(newsId);
    }

    @Override
    public void like(String newsId) {
        mModel.like(newsId);
    }

    @Override
    public void cancelLike(String newsId) {
        mModel.cancelLike(newsId);
    }

    @Override
    public void sendComment(String title, String catalogId, String type, String id, String commentUser, String content) {
        mModel.sendComment(title, catalogId, type, id, commentUser, content);
    }

    @Override
    public void getCoin(String username) {
        mModel.getCoin(username);
    }

    @Override
    public void getCoinSuccess(CoinBean bean) {
        mView.getCoinSuccess(bean);
    }

    @Override
    public void getCoinFailure(String msg) {
        mView.getCoinFailure(msg);
    }

    @Override
    public void getCommentCoin(String name, String type) {
        mModel.getCommentCoin(name,type);
    }

    @Override
    public void getCommentCoinSuccess(CoinBean coinBean) {
        mView.getCommentCoinSuccess(coinBean);
    }

    @Override
    public void getCommentCoinFailure(String msg) {
        mView.getCommentCoinFailure(msg);
    }

    @Override
    public void shareCount(String newsId) {
        mModel.shareCount(newsId);
    }
}
